<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AddColIsAgentPromotionToCoursesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('courses', function (Blueprint $table) {
            $table->tinyInteger('is_agent_promotion')->default(0)->comment('是否参与代理推广')->after('is_featured');
            $table->decimal('first_ratio')  ->default(0)->comment('一级佣金比率')->after('is_agent_promotion');
            $table->decimal('secondary_ratio')->default(0)->comment('二级佣金比率')->after('first_ratio');
            $table->text('reward_rule')->nullable()->comment('奖励规则')->after('secondary_ratio');
            $table->integer('poster_img_id')->default(0)->comment('海报背景图')->after('reward_rule');
            $table->integer('share_poster_img_id')->default(0)->comment('分享海报图')->after('poster_img_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('courses', function (Blueprint $table) {
            //
        });
    }
}
